package com.xbao.service.impl;

import com.github.pagehelper.PageHelper;
import com.xbao.core.http.CommRequest;
import com.xbao.core.util.MyBeanUtil;
import com.xbao.core.util.pub.tool.StringUtils;
import com.xbao.dao.MVideoMapper;
import com.xbao.model.MVideo;
import com.xbao.model.MVideoExample;
import com.xbao.model.VStu;
import com.xbao.model.VStuExample;
import com.xbao.model.req.MVideoReq;
import com.xbao.model.vo.MVideoVo;
import com.xbao.model.vo.StuVo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class MVideoServiceImpl implements com.xbao.service.MVideoService {
    @Resource
    private MVideoMapper mVideoMapper;

    @Override
    public List<MVideoVo> getMVideos(CommRequest<MVideoReq> mVideoReqCommRequest) {
        MVideoExample mExample = new MVideoExample();
        MVideoReq mReq=mVideoReqCommRequest.getData();
        MVideoExample.Criteria criteria = mExample.createCriteria();
        if (mReq.getPager() != null) {
            PageHelper.startPage(mReq.getPager().getPageNo(), mReq.getPager().getPageSize());
            mExample.setOrderByClause("id desc");
        }
        List<MVideo> ms = mVideoMapper.selectByExample(mExample);
        List<MVideoVo> vos = MyBeanUtil.copyList(ms, MVideoVo.class);
        return vos;
    }
}
